import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';

export const columns: BasicColumn[] = [
  {
    title: 'ID',
    dataIndex: 'id',
    width: 50,
    align: 'center',
  },
  {
    title: '任务名称',
    dataIndex: 'title',
    width: 100,
    align: 'center',
  },
  {
    title: '教师姓名',
    dataIndex: 'fname',
    width: 100,
    align: 'center',
  },
  {
    title: '教师工号',
    dataIndex: 'fnumber',
    width: 100,
    align: 'center',
  },
  {
    title: '报告内容',
    dataIndex: 'content',
    width: 100,
    align: 'center',
  },
  {
    title: '申报积分',
    dataIndex: 'integral',
    width: 100,
    align: 'center',
  },
  //====
  {
    title: '审批状态',
    dataIndex: 'status',
    width: 100,
    align: 'center',
  },


  {
    title: '审批状态',
    dataIndex: 'status',
    width:120,
    customRender: ({ record }) => {
      const status = record.status;
      let color = 'blue';
      let val = '';
      switch (status){
        case 3:color='red';break;
        case 4:color='red';break;
        case 5:color='green';break;
      }
      switch (status){
        case 0:val='初审中';break;
        case 1:val='初审中';break;
        case 2:val='二次审核中';break;
        case 3:val='初审失败';break;
        case 4:val='二次审核失败';break;
        case 5:val='审核完成';break;
      }
      return h(Tag, { color: color }, () => val);
    },
  },
  {
    title: '创建时间',
    dataIndex: 'create_time',
    width: 180,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'id',
    label: '任务id',
    component: 'Input',
    colProps: { span: 8 },
  }
];

//新增弹窗form字段
export const formSchema: FormSchema[] = [
  {
    label: 'ID',
    field: 'id',
    component: 'Input',
    defaultValue: 0,
    show: false,
  },
  {
    field: 'task_id',
    label: '任务编号',
    component: 'Input',
    required: true,
  },
  {
    field: 'teacher_id',
    label: '教师编号',
    component: 'Input',
    required: true,
  },
  {
    label: '报告内容',
    field: 'content',
    component: 'Input',
    defaultValue: '',
    required: false,
  },
  {
    label: '申请积分',
    field: 'integral',
    component: 'Input',
    defaultValue: '',
    required: false,
  },  {
    label: '备注',
    field: 'tips',
    component: 'Input',
    defaultValue: '',
    required: false,
  },
];
